-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio: ASRC: Code reorganization #8514
Conversation
andrula-song
commented
Nov 23, 2023
- Move all ASRC related header files into src/audio/asrc folder.
- split IPC version related code to asrc_ipc3.c and asrc_ipc4.c.
SOFCI TEST |
100cd0b
to
17291ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
17291ee
to
764500f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make the Cmake/Kconfig changes later as there are other PRs that need to be merged 1st.
@@ -174,12 +174,14 @@ set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover tdfb | |||
# sources for each module | |||
if(CONFIG_IPC_MAJOR_3) | |||
set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc3.c) | |||
set(asrc_sources asrc/asrc_ipc3.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singalsu @andrula-song @btian1 These should really be in src/audio/module_name/CMakefile.txt
(same rule applies to Kconfig too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, shall we use a separate pr to do the clean up once we finished all module converter.
this is because the in-complete of Cmakelist in module, some does not have, some does not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood , this change is based on search, so I request use a separate PR to track clean up src/audio/cMakeList.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, "asrc_sources" was not set before this PR, so why do it now. It seems we already go to the asrc subdirectory, so I don't see why we need to add individual source files here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, it is first set in line 196 as "set(asrc_sources asrc/asrc.c asrc/asrc_farrow.c asrc/asrc_farrow_generic.c)"
. Adding here is just to keep the asrc_sources right after I refine ASRC code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack @andrula-song . I still don't understand why we set the module sources list twice, but clearly this was not added in this PR, so should not block this one. Let's handle separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand why we set the module sources list twice,
Same "LIBRARY" explanation as in #8595 (comment), isn't it?
SOFCI TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, needs the cleanups in a different patch.
764500f
to
232dde8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it much better with the typedef
!
232dde8
to
0e3f1f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need to move it to ASRC folder ? Thanks!
SOFCI TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good here.
src/audio/asrc/asrc.c
Outdated
#else | ||
const struct ipc4_asrc_module_cfg *ipc_asrc = mod_data->cfg.init_data; | ||
#endif | ||
const ipc_asrc_cfg *ipc_asrc = mod_data->cfg.init_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a code change (I know, no impact), but should come in another patch.
src/audio/asrc/asrc.h
Outdated
asrc_proc_func asrc_func; /* ASRC processing function */ | ||
}; | ||
|
||
#ifndef CONFIG_IPC_MAJOR_4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now. We can incrementally update if needed.
src/audio/asrc/asrc.h
Outdated
#ifdef CONFIG_IPC_MAJOR_4 | ||
typedef struct ipc4_asrc_module_cfg ipc_asrc_cfg; | ||
#else | ||
typedef struct ipc_config_asrc ipc_asrc_cfg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine for now, we can split this further later if needed.
0e3f1f2
to
b91436d
Compare
b91436d
to
79b9546
Compare
ALSA plugin build failure https://github.com/thesofproject/sof/actions/runs/7081524859/job/19272763291?pr=8514 discussed in #8538 |
@lyakh , with typedef, there are codestyle errors, do you still insist use typedef, how about #define, or directly use # if IPC3? |
@btian1 I never insisted on that, it was my proposal. I still think it's ok to ignore code style complaints in this case, but if others disagree we can also use a |
src/audio/asrc/asrc_config.h
Outdated
@@ -16,7 +16,7 @@ | |||
#if defined __XCC__ | |||
/* For xt-xcc */ | |||
#include <xtensa/config/core-isa.h> | |||
#if XCHAL_HAVE_HIFI3 == 1 | |||
#if XCHAL_HAVE_HIFI3 == 1 || XCHAL_HAVE_HIFI4 == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't really a code reorganization... It's really not good practice to add such configuration changes in the middle or a code move...
This should be in a separate patch IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a separate commit at last.
Checkpatch is not always right: https://www.kernel.org/doc/html/latest/dev-tools/checkpatch.html
I wish people obsessed at least as much about actual test results as about checkpatch. "Do not add any new |
79b9546
to
b62e218
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly look good, a few minor comments inline.
@@ -174,12 +174,14 @@ set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover tdfb | |||
# sources for each module | |||
if(CONFIG_IPC_MAJOR_3) | |||
set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc3.c) | |||
set(asrc_sources asrc/asrc_ipc3.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, "asrc_sources" was not set before this PR, so why do it now. It seems we already go to the asrc subdirectory, so I don't see why we need to add individual source files here.
src/audio/asrc/asrc_ipc3.c
Outdated
|
||
void asrc_update_buffer_format(struct comp_buffer *buf_c, struct comp_data *cd) | ||
{ | ||
//IPC3 don't need to update audio stream format here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C-style comments would be better
src/audio/asrc/asrc_ipc3.c
Outdated
|
||
void asrc_set_stream_params(struct comp_data *cd, struct sof_ipc_stream_params *params) | ||
{ | ||
//IPC3 don't need to set audio stream params here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here
Move the ASRC related header files into ASRC folder. Signed-off-by: Andrula Song <[email protected]>
Use typedef ipc_asrc_cfg to replace the splited IPC version asrc module config structure. Signed-off-by: Andrula Song <[email protected]>
Move IPC3 related code to asrc_ipc3.c and IPC4 related code to asrc_ipc4.c. Signed-off-by: Andrula Song <[email protected]>
Make HiFi4 share c source files with HiFi3. Signed-off-by: Andrula Song <[email protected]>
b62e218
to
756314f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! With assumption Kai's findings fixed.
@@ -174,12 +174,14 @@ set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover tdfb | |||
# sources for each module | |||
if(CONFIG_IPC_MAJOR_3) | |||
set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc3.c) | |||
set(asrc_sources asrc/asrc_ipc3.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack @andrula-song . I still don't understand why we set the module sources list twice, but clearly this was not added in this PR, so should not block this one. Let's handle separately.